/*
 * @Description:
 * @Author: py
 * @Date: 2024-12-12
 */
export function useDicts() {
    const oBusinessType = {
        1: '小桔充电',
    }
    const oEquipSupplier = {
        1: '设备商A',
        2: '设备商B',
        3: '设备商C',
    }
    const oOperator = {
        城服集团: '城服集团',
    }
    const oInvoiceType = {
        1: '固定比例',
        2: '阶梯式比例',
    }
    const oInvoiceStatus = {
        1: '未开票',
        2: '开票中',
        3: '已开票',
    }
    const dicts = {
        oBusinessType,
        oEquipSupplier,
        oInvoiceStatus,
        oInvoiceType,
        oOperator,
    }

    const getDictLabel = (mapKey: string, dicKey: number | string) => {
        if (mapKey in dicts) {
            return dicts[mapKey][dicKey]
        }
        else {
            return ''
        }
    }

    const getDictOptions = (mapKey: string) => {
        if (mapKey in dicts) {
            const targetMap = dicts[mapKey]
            const dictOptions = Object.entries(targetMap).map(([key, val]: [string, string]) => ({
                label: val,
                value: key,
            }))
            return ref(dictOptions)
        }
        else {
            return ref([])
        }
    }

    return { getDictLabel, getDictOptions }
}
